package com.gsit.expenditure.client.domina;

import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Locale;

import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.CheckBox;


import com.gsit.expenditure.domain.Vehicle;

import eu.schudt.javafx.controls.calendar.DatePicker;


public class VehicleBean implements BeanHendler<Vehicle > {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private StringProperty vehicleNumber = new SimpleStringProperty("");
	private StringProperty vehicleName = new SimpleStringProperty();
	private StringProperty vehicleType = new SimpleStringProperty("");
	private StringProperty modelName = new SimpleStringProperty("");
	private StringProperty engineNumber = new SimpleStringProperty("");
	private StringProperty manufacturedYear = new SimpleStringProperty("");
	private DoubleProperty rate = new SimpleDoubleProperty();
		

private Vehicle vehicle;
	
	public VehicleBean(Vehicle vehicle){
		if(vehicle == null){
			vehicle  = new Vehicle();
			
		}
		this.vehicle = vehicle;
		init(vehicle);
	}
	
	

	@Override
	public void init(Vehicle t) {
	
		vehicleNumber.setValue(vehicle.getVehicleNumber());
		vehicleName.setValue(vehicle.getVehicleName());
		vehicleType.setValue(vehicle.getVehicleType());
		modelName.setValue(vehicle.getModelName());
		engineNumber.setValue(vehicle.getEngineNumber());
		manufacturedYear.setValue(vehicle.getManufacturedYear());
		
		rate.setValue(vehicle.getRate());
		
	}

	@Override
	public void reLoad(Vehicle vehicle) {
		this.vehicle=vehicle;
		init(vehicle);
	}

	@Override
	public void clean() {
	
		vehicleNumber.setValue("");
		vehicleName.setValue("");
		vehicleType.setValue("");
		modelName.setValue("");
		engineNumber.setValue("");
		manufacturedYear.setValue("");
		
	}

	@Override
	public Vehicle getObject() {
		
		vehicle.setVehicleNumber(vehicleNumber.getValue());
		vehicle.setVehicleName(vehicleName.getValue());
		vehicle.setVehicleType(vehicleType.getValue());
		vehicle.setModelName(modelName.getValue());
		vehicle.setEngineNumber(engineNumber.getValue());
		vehicle.setManufacturedYear(manufacturedYear.getValue());
		vehicle.setRate(rate.getValue());
				
		return vehicle;
	}



	public StringProperty getVehicleNumber() {
		return vehicleNumber;
	}


	public void setVehicleNumber(StringProperty vehicleNumber) {
		this.vehicleNumber = vehicleNumber;
	}


	public StringProperty getVehicleName() {
		return vehicleName;
	}


	public void setVehicleName(StringProperty vehicleName) {
		this.vehicleName = vehicleName;
	}


	public StringProperty getVehicleType() {
		return vehicleType;
	}


	public void setVehicleType(StringProperty vehicleType) {
		this.vehicleType = vehicleType;
	}


	public StringProperty getModelName() {
		return modelName;
	}


	public void setModelName(StringProperty modelName) {
		this.modelName = modelName;
	}


	public StringProperty getEngineNumber() {
		return engineNumber;
	}


	public void setEngineNumber(StringProperty engineNumber) {
		this.engineNumber = engineNumber;
	}


	public StringProperty getManufacturedYear() {
		return manufacturedYear;
	}


	public void setManufacturedYear(StringProperty manufacturedYear) {
		this.manufacturedYear = manufacturedYear;
	}


	public static long getSerialversionuid() {
		return serialVersionUID;
	}


	public Vehicle getVehicle() {
		return vehicle;
	}


	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	public DoubleProperty getRate() {
		return rate;
	}
	public void setRate(DoubleProperty rate) {
		this.rate = rate;
	}


	
	
	
}
